home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
dev
/
obero
/
oberon_lib.lha
/
oberon-a
/
source1.lha
/
source
/
ProjectOberon
/
Oberon.mod
< prev
next >
Wrap
Text File
|
1994-08-08
|
3KB
|
135 lines
(***************************************************************************
$RCSfile: Oberon.mod $
Description: Partial port of the Project Oberon module
Created by: fjc (Frank Copeland)
$Revision: 1.5 $
$Author: fjc $
$Date: 1994/08/08 16:40:46 $
Copyright © 1994, Frank Copeland.
This file is part of the Oberon-A Library.
See Oberon-A.doc for conditions of use and distribution.
Log entries are at the end of the file.
***************************************************************************)
MODULE Oberon;
(*
** $C= CaseChk $I= IndexChk $L+ LongAdr $N= NilChk
** $P= PortableCode $R= RangeChk $S= StackChk $T= TypeChk
** $V= OvflChk $Z= ZeroVars
*)
IMPORT Dos;
(*------------------------------------*)
PROCEDURE ADOS2OberonTime *
(VAR ds : Dos.Date; VAR time, date : LONGINT);
(*
Adapted from ParseDate() in module Dates, Copyright 1987 by:
Dale W. Thompson, 14500 Dallas Pkwy. #2091, Dallas, TX 75240
*)
VAR year, month, day, hour, min, sec : LONGINT;
Days : ARRAY 12 OF INTEGER;
LeapDays : ARRAY 12 OF INTEGER;
PROCEDURE Leap ( year : LONGINT ) : BOOLEAN;
BEGIN
RETURN ((year-1976) MOD 4) = 0
END Leap;
BEGIN (* ADOS2OberonTime *)
hour := ds.minute DIV 60;
min := ds.minute MOD 60;
sec := ds.tick DIV Dos.ticksPerSecond;
Days[0] := 31; LeapDays[0] := 31;
Days[1] := 28; LeapDays[1] := 29;
Days[2] := 31; LeapDays[2] := 31;
Days[3] := 30; LeapDays[3] := 30;
Days[4] := 31; LeapDays[4] := 31;
Days[5] := 30; LeapDays[5] := 30;
Days[6] := 31; LeapDays[6] := 31;
Days[7] := 31; LeapDays[7] := 31;
Days[8] := 30; LeapDays[8] := 30;
Days[9] := 31; LeapDays[9] := 31;
Days[10] := 30; LeapDays[10] := 30;
Days[11] := 31; LeapDays[11] := 31;
day := ds.days;
year := 1978;
LOOP
IF Leap (year) THEN
IF day < 366 THEN
EXIT;
ELSE
DEC( day,366 );
END;
ELSE
IF day < 365 THEN
EXIT;
ELSE
DEC( day,365 );
END;
END;
INC (year);
END; (* LOOP *)
INC (day);
month := 0;
IF Leap (year) THEN
WHILE day > LeapDays [month] DO
DEC (day, LeapDays [month]);
INC (month);
END;
ELSE
WHILE day > Days [month] DO
DEC (day, Days [month]);
INC (month);
END;
END;
INC (month);
time := (hour * 64 + min) * 64 + sec;
date := (year * 16 + month) * 32 + day;
END ADOS2OberonTime;
(*------------------------------------*)
PROCEDURE GetClock * (VAR time, date : LONGINT);
VAR ds : Dos.Date;
BEGIN (* GetClock *)
Dos.base.DateStamp (ds);
ADOS2OberonTime (ds, time, date);
END GetClock;
END Oberon.
(***************************************************************************
$Log: Oberon.mod $
Revision 1.5 1994/08/08 16:40:46 fjc
Release 1.4
Revision 1.4 1994/06/14 02:14:31 fjc
- Updated for release
Revision 1.3 1994/06/04 16:03:39 fjc
- Changed to use new Amiga interface
Revision 1.2 1994/05/12 20:45:18 fjc
- Prepared for release
# Revision 1.1 1994/01/15 21:39:12 fjc
# Start of revision control
#
***************************************************************************)